﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:BadHabit_Factory_Controls="clr-namespace:BadHabit.Factory.Controls"  
    xmlns:BadHabit_WPFTools="clr-namespace:BadHabit.WPFTools;assembly=BadHabit.WPFTools"
    xmlns:BadHabit_Factory_Converters="clr-namespace:BadHabit.Factory.Converters"  
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:props="clr-namespace:BadHabit.Factory.Properties"
    >


    <BadHabit_Factory_Converters:TaskIdConverter x:Key="TaskIdConverter"/>
    
    

    <Style TargetType="RadioButton">
        <Setter Property="FontFamily" Value="{StaticResource BasicFont}"/>
        <Setter Property="FontSize" Value="{StaticResource BasicFontSize}"/>
        <Setter Property="Margin" Value="2,4,2,7"/>
        <Setter Property="VerticalAlignment"  Value="Center"/>
    </Style>



    <!--<Style TargetType="GroupBox">
        <Setter Property="Foreground" Value="{StaticResource DarkTextBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource DarkTextBrush}"/>
        <Setter Property="Margin" Value="3"/>
        <Setter Property="Padding" Value="1,5,5,5"/>
    </Style>-->
    
    <Style TargetType="GroupBox">        
        <Setter Property="Margin" Value="0,0,5,3"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="GroupBox">
                    <Grid VerticalAlignment="Stretch">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Border Grid.Row="0" BorderThickness="0,0,0,0" BorderBrush="{StaticResource DarkTextBrush}" Margin="0">
                            <!--<ContentPresenter ContentSource="Header" TextBlock.FontSize="16" TextBlock.Foreground="#0050B0" Margin="0" />-->
                            <ContentPresenter ContentSource="Header" TextBlock.FontSize="16" TextBlock.Foreground="SteelBlue" Margin="0" />
                        </Border>
                        <ContentPresenter Grid.Row="1" Margin="0,0,0,0" VerticalAlignment="Stretch" />
                    </Grid>                                                                
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>




    <Style TargetType="StatusBar">
        <Setter Property="FontFamily" Value="{StaticResource BasicFont}"/>
        <Setter Property="FontSize" Value="{StaticResource BasicFontSize}"/>
        <Setter Property="BorderBrush" Value="{StaticResource ProjectPanelBorderBrush}"/>
        <Setter Property="BorderThickness" Value="0,1,0,0"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="MinHeight" Value="18"/>
        
        <Setter Property="Background">
            <Setter.Value>
                <SolidColorBrush Color="{StaticResource LightColor}"/>
            </Setter.Value>
        </Setter>
        <Setter Property="Foreground" Value="{StaticResource DarkTextBrush}"/>
    </Style>

    <!--<Style TargetType="Hyperlink">
        <Setter Property="FontFamily" Value="{StaticResource BasicFont}"/>
        <Setter Property="Foreground" Value="{StaticResource DarkTextBrush}"/>
    </Style>-->

    <Style TargetType="{x:Type Hyperlink}">
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">                
                <Setter Property="TextBlock.TextDecorations" Value="Underline" />
            </Trigger>
        </Style.Triggers>
        <Setter Property="Foreground" Value="SteelBlue" />
        <Setter Property="TextBlock.TextDecorations" Value="{x:Null}" />
        
    </Style>

    <Style x:Key="RadioButtonListBoxItem" TargetType="ListBoxItem">                        
        <Setter Property="Margin" Value="2, 2, 2, 0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>               
                        <RadioButton                        
                            Focusable="False"
                            Content="{TemplateBinding ContentPresenter.Content}"
                            IsChecked="{Binding Path=IsSelected,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}"/>        
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ToolTip x:Key="TaskToolTip" ToolTipService.InitialShowDelay="4000" ToolTipService.BetweenShowDelay="2000">
        <StackPanel Orientation="Vertical">
            <TextBlock Grid.Row="0" Text="{Binding TaskId, Converter={StaticResource TaskIdConverter}}" FontWeight="Bold" />
            <TextBlock Grid.Row="0" Text="{Binding TaskName}" FontWeight="Bold" />            
            <WrapPanel>
                <TextBlock Grid.Row="1" Text="{Binding ClientName, StringFormat='{}{0} - '}" />
                <TextBlock Text="{Binding ProjectName, StringFormat='{}{0} ['}" />                
                <TextBlock Text="{Binding ProjectNumber, StringFormat='{}{0}]'}" />                
            </WrapPanel>
            <WrapPanel>
                <TextBlock Text="{Binding Title, StringFormat='{}{0}'}" />
                <TextBlock Text="[" />
                <TextBlock Text="{Binding BacklogItemNumber, StringFormat='{}{0}]'}" />                
            </WrapPanel>
            <TextBlock Text="{Binding TaskOwner}" />
            <TextBlock Text="{Binding PlannedEffort, StringFormat='{}{0:F1} hrs'}" FontWeight="Bold" />
        </StackPanel>
    </ToolTip>

    <ControlTemplate x:Key="ExpanderToggleButton" TargetType="ToggleButton">
        <Border Background="Transparent" HorizontalAlignment="Stretch" Cursor="Hand">
            
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
            <Path      
                Grid.Column="0"
                Margin="2,0,0,0"
            Name="Arrow"
            Fill="{StaticResource DarkBrush}"
            HorizontalAlignment="Left"
            VerticalAlignment="Center"
            Data="M 0 0 L 4 4 L 8 0 Z"/>

                <ContentPresenter Grid.Column="1"  />                                   
                                   

            </Grid>
            

        </Border>                    
        <ControlTemplate.Triggers>
            <Trigger Property="ToggleButton.IsMouseOver" Value="True">
                <Setter TargetName="Arrow" Property="Fill" Value="{StaticResource HighLightBrush}" />
            </Trigger>            
            <Trigger Property="IsChecked" Value="True">
                <Setter TargetName="Arrow" Property="Data" Value="M 0 4 L 4 0 L 8 4 Z" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">                
                <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
                <Setter TargetName="Arrow" Property="Fill" Value="{StaticResource DisabledForegroundBrush}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style TargetType="Expander">
        <Setter Property="Template">            
            <Setter.Value>
                <ControlTemplate TargetType="Expander">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Name="ContentRow" Height="0"/>
                        </Grid.RowDefinitions>                                           
                                
                        <ToggleButton
                                    Grid.Row="0"
                                    
                                    Grid.Column="0"                            
                                    HorizontalAlignment="Stretch"                                    
                                    IsChecked="{Binding Path=IsExpanded,Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                    OverridesDefaultStyle="True"                                     
                                    Template="{StaticResource ExpanderToggleButton}" >

                                <ContentPresenter                                     
                                    
                                    x:Name="headerPresenter"
                                    ContentSource="Header"                                    
                                    />

                            <ToggleButton.Style>
                                <Style>
                                    <Style.Triggers>
                                        <Trigger Property="ToggleButton.IsChecked" Value="True">
                                            <Setter Property="ToggleButton.IsTabStop" Value="False"/>
                                            <Setter Property="KeyboardNavigation.DirectionalNavigation" Value="Local"/>
                                        </Trigger>
                                        <Trigger Property="ToggleButton.IsChecked" Value="False">
                                            <Setter Property="ToggleButton.IsTabStop" Value="True"/>
                                            <Setter Property="KeyboardNavigation.DirectionalNavigation" Value="None"/>
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>
                            </ToggleButton.Style>
                        </ToggleButton>
                        

                        <ContentPresenter x:Name="Content" Grid.Row="1"  Margin="0,0,0,0"  />


                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsExpanded" Value="True">
                            <Setter TargetName="ContentRow" Property="Height" Value="{Binding ElementName=Content,Path=DesiredHeight}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">                            
                            <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
                        </Trigger>
                        <Trigger Property="ContentPresenter.IsHitTestVisible" Value="True">
                            <Setter TargetName="headerPresenter" Property="ContentPresenter.IsHitTestVisible" Value="True"/>
                        </Trigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style TargetType="{x:Type TabControl}">             
        <Setter Property="BorderBrush" Value="#0050B0"/>
        <Setter Property="BorderThickness" Value="0,2,0,0"/>
        <Setter Property="Background" Value="{StaticResource GradientSilverTubeBrush}"/>
    </Style>


    <Style TargetType="{x:Type TabItem}">
        <Setter Property="Template">

            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Border x:Name="border" BorderThickness="1,1,1,2" BorderBrush="#0050B0" Padding="4" Margin="0,0,3,-2" Cursor="Hand">
                        <Border.Background>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                <GradientStop Color="#AAAAAA" Offset="0"/>                              
                                <GradientStop Color="#CCCCCC" Offset="0.2"/>
                                <GradientStop Color="#EFEFEF" Offset="1"/>
                            </LinearGradientBrush>
                        </Border.Background>
                    <ContentPresenter                                
                            x:Name="ContentSite"
                                                   
                            ContentSource="Header"
                            TextBlock.FontFamily="{StaticResource BasicFont}"
                            TextBlock.FontSize="{StaticResource BasicFontSize}"
                            TextBlock.Foreground="#0050B0"/>
                    </Border>

                    <ControlTemplate.Triggers>
                        
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="ContentSite" Property="TextBlock.Foreground" Value="Gray"/>                            
                        </Trigger>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter TargetName="border" Property="BorderThickness" Value="1,1,1,0"/>
                            <Setter TargetName="border" Property="Background" Value="#EFEFEF"/>
                            <Setter TargetName="border" Property="Cursor" Value="Arrow"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


 
    



</ResourceDictionary>